﻿namespace CabinetGrid.DeviceDriver.Core;


public class AppConfig
{
    public TcpServerConfig TcpServer { get; set; }
    public string RFIDReaderCategory { get; set; }
    public List<RFIDReaderConfig> RFIDReaderList { get; set; }
    public LockerConfig Locker { get; set; }
    public CardReaderConfig CardReader { get; set; }
    public WebhookConfig Webhook { get; set; }
    public DaemonConfig Daemon { get; set; }
    public string RegCode { get; set; }
}

public class TcpServerConfig
{
    public string Http { get; set; }
    public string WebSocket { get; set; }
}

public class RFIDReaderConfig
{
    public string Kind { get; set; }
    public string ConnectType { get; set; }
    public string ConnectArgs { get; set; }

    internal bool Enable => this.ConnectType.HasValue( ) && this.ConnectArgs.HasValue( );
}

public class LockerConfig : RFIDReaderConfig { }

public class CardReaderConfig : RFIDReaderConfig { }

public class WebhookConfig
{
    public bool Enable { get; set; }
    public string Url { get; set; }
    public int Retry { get; set; }
}


public record DaemonConfig
{
    public string FilePath { get; set; }
    public int IntervalSeconds { get; set; }
}
